# utils/password_util.py
import hashlib

class PasswordUtil:
    """密码工具类"""
    
    @staticmethod
    def hash_password(password):
        """SHA256加密密码"""
        return hashlib.sha256(password.encode('utf-8')).hexdigest()
    
    @staticmethod
    def verify_password(password, hashed_password):
        """验证密码"""
        return PasswordUtil.hash_password(password) == hashed_password

# 如果需要生成密码哈希值，可以运行这个脚本
if __name__ == '__main__':
    password = '940429'
    hashed = PasswordUtil.hash_password(password)
    print(f"密码: {password}")
    print(f"哈希值: {hashed}")
